/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
 var findBottomLeftValue = function(root) {
  let arr = []
  arr[0]=root.val
  function getValue(tree,dept){
    if(tree.left){
      arr[dept]=tree.val
      getValue(tree.left,dept++)
    }

    if(tree.right){
      getValue(tree.right,dept++)
    }
  }
  getValue(root,1)
  return arr[arr.length-1]
};